home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / esc.jar / com / extensibility / esc / BaseStatusBar$SBArea.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-30  |  3.1 KB  |  101 lines

  1. package com.extensibility.esc;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Component;
  5. import java.awt.Container;
  6. import java.awt.Dimension;
  7. import java.awt.GridBagConstraints;
  8. import java.awt.GridBagLayout;
  9. import java.awt.Insets;
  10. import javax.swing.Icon;
  11. import javax.swing.JComponent;
  12. import javax.swing.JLabel;
  13. import javax.swing.JPanel;
  14. import javax.swing.border.SoftBevelBorder;
  15.  
  16. class BaseStatusBar$SBArea extends JPanel implements BaseStatusBar.IStatusBar {
  17.    // $FF: renamed from: id java.lang.String
  18.    protected String field_0 = "id1";
  19.    protected int H_TEXTINSET = 14;
  20.    protected SoftBevelBorder sbb;
  21.    protected float percentWidth;
  22.    protected boolean dinamicWidth;
  23.    private int pos = -1;
  24.    private int width = -1;
  25.    private int height = -1;
  26.    JLabel label;
  27.  
  28.    BaseStatusBar$SBArea(String var1, float var2, boolean var3) {
  29.       super(new GridBagLayout());
  30.       GridBagConstraints var4 = new GridBagConstraints();
  31.       this.field_0 = var1;
  32.       this.percentWidth = var2;
  33.       this.dinamicWidth = var3;
  34.       this.sbb = new SoftBevelBorder(1, Color.white, Color.lightGray, Color.lightGray, Color.gray);
  35.       ((JComponent)this).setBorder(this.sbb);
  36.       var4.insets = new Insets(0, 0, 0, 0);
  37.       var4.gridx = 0;
  38.       var4.gridy = 0;
  39.       var4.weightx = (double)1.0F;
  40.       var4.weighty = (double)1.0F;
  41.       var4.anchor = 17;
  42.       var4.fill = 1;
  43.       this.label = new JLabel("");
  44.       ((Container)this).add(this.label, var4);
  45.    }
  46.  
  47.    BaseStatusBar$SBArea(String var1, int var2, int var3) {
  48.    }
  49.  
  50.    public Dimension getPreferredSize() {
  51.       this.refreshPosAndWidth();
  52.       return new Dimension(this.width, this.height);
  53.    }
  54.  
  55.    public String getID() {
  56.       return this.field_0;
  57.    }
  58.  
  59.    public String getLabelText() {
  60.       return this.label.getText();
  61.    }
  62.  
  63.    public void setLabelText(String var1) {
  64.       this.label.setText(var1);
  65.    }
  66.  
  67.    public Icon getStatusBarIcon() {
  68.       return this.label.getIcon();
  69.    }
  70.  
  71.    public void setStatusBarIcon(Icon var1) {
  72.       this.label.setIcon(var1);
  73.    }
  74.  
  75.    public float getPercentWidth() {
  76.       return this.percentWidth;
  77.    }
  78.  
  79.    public void setPercentWidth(float var1) {
  80.       this.percentWidth = var1;
  81.    }
  82.  
  83.    public JPanel getPanel() {
  84.       return this;
  85.    }
  86.  
  87.    private void refreshPosAndWidth() {
  88.       Container var1 = ((Component)this).getParent();
  89.       int var2 = ((Component)var1).getSize().width;
  90.       if (this.dinamicWidth || this.width < 0) {
  91.          float var3 = (float)var2 * this.percentWidth;
  92.          this.width = (new Float(var3)).intValue();
  93.       }
  94.  
  95.       if (this.height < 0) {
  96.          this.height = ((Component)this).getFontMetrics(((Component)this).getFont()).getHeight() + 4;
  97.       }
  98.  
  99.    }
  100. }
  101.